<?php
$this->breadcrumbs = array(
	'供货商列表',
);
if (Yii::app()->user->checkAccess('merchantManage')) {
	$this->userActions = array(
		array(
			'label' => '新建供货商',
			'url' => array(
				'create'
			)
		),
		array(
			'label' => '管理供货商',
			'url' => array(
				'admin'
			)
		),
	);
}
Yii::app()->clientScript
	->registerScript('search-merchant',
		"
$('#merchant-search-button').click(function(){
        $.fn.yiiListView.update('merchant-list', {
                data: $('#merchant-search-form').serialize()
        });
        return false;
});
");

?>

<h1>供货商列表</h1>
<div class="form">
<?php $form = $this
	->beginWidget('CActiveForm',
		array(
			'id' => 'merchant-search-form',
			'action' => Yii::app()->createUrl($this->route),
			'method' => 'get',
		));
?>

	<?php echo $form->errorSummary($searchModel); ?>
<fieldset>
<legend>搜索条件</legend>
	<div class="span-18">
		<?php echo $form->labelEx($searchModel, 'keyword'); ?>
		<?php echo $form->textField($searchModel, 'keyword', array(
				'size' => 20
			));
		?> 
		<?php echo $form
			->checkBoxList($searchModel, 'keywordRange', MerchantSearch::getKeywordRanges(),
				array(
					//'checkAll' => '全选',
					'separator' => '&nbsp;',
					'labelOptions' => array(
						'style' => 'float: none; width: auto; display: inline;'
					)
				));
		?>
	</div>
	<div class="clear"></div>
	<div class="span-18">
		<?php echo $form->labelEx($searchModel, 'address'); ?>
		<?php echo $form->textField($searchModel, 'address', array(
				'size' => 20
			));
		?>
	</div>
	<div class="row buttons">
		<?php echo CHtml::submitButton('搜索', array(
			'id' => 'merchant-search-button'
		));
		?>
	</div>
</fieldset>
<?php $this->endWidget(); ?>
</div>
<?php $this
	->widget('zii.widgets.CListView',
		array(
			'id' => 'merchant-list',
			'dataProvider' => $dataProvider,
			'itemView' => '_view',
			'separator' => '<div class="list-item-separator"></div>',
		));
?>
